package com.hean.activity;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;

public class ContentProviderUser extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ContentResolver resolver=this.getContentResolver();
        System.out.println(resolver.acquireContentProviderClient("com.hean.provider.contactprovider"));
//		Uri uri=Uri.parse("content://com.hean.provider.contactprovider/t_contact");
//		ContentValues values=new ContentValues();
//		values.put("name", "hean");
//		values.put("phone", "123");
//		resolver.insert(uri, values);
//		uri=Uri.parse("content://com.hean.provider.contactprovider/t_contact/id??");
//		resolver.update(uri, values, null, null);
//		resolver.delete(uri, null, null);
//		uri=Uri.parse("content://com.hean.provider.contactprovider/t_contact");
//		Cursor cursor=resolver.query(uri, new String[]{"_id","name","phone"}, 
//				null, null, "_id desc");
//		while(cursor.moveToNext()){
//			System.out.println("name:"+cursor.getString(2));
//		}
    }
}